﻿<?php
error_reporting(0);
define('IN_QY',true);
session_start();
require("include/common.inc.php");
define('SCRIPT','ad_list');

?>

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>搜索中心-众晒网</title>
        <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport"/>
        <meta content="yes" name="apple-mobile-web-app-capable"/>
        <meta content="black" name="apple-mobile-web-app-status-bar-style"/>
        <meta content="telephone=no" name="format-detection"/>
        <link href="/ui/xianzhi/css/style.css" rel="stylesheet" type="text/css"/>
        <script type="text/javascript" src="/ui/xianzhi/js/jquery.min.js"></script>
        <script type="text/javascript" src="/ui/xianzhi/js/slider.js"></script>
        <script type="text/javascript" src="/ui/xianzhi/js/tab.js"></script>
		<script type="text/javascript" src="/ui/layer/mobile/layer.js"></script>   
				<script src="dropload.min.js"></script>
				
				<style>
					  .content{
        max-width: 640px;
        margin: 0 auto;
        background-color: #fff;
    }
		.dropload-up,.dropload-down{
    position: relative;
    height: 0;
    overflow: hidden;
    font-size: 12px;
    /* 开启硬件加速 */
    -webkit-transform:translateZ(0);
    transform:translateZ(0);
}
.dropload-down{
    height: 0px;
}
.dropload-refresh,.dropload-update,.dropload-load,.dropload-noData{
    height: 0px;
    line-height: 50px;
    text-align: center;
}
.dropload-load .loading{
    display: inline-block;
    height: 15px;
    width: 15px;
    border-radius: 100%;
    margin: 6px;
    border: 2px solid #666;
    border-bottom-color: transparent;
    vertical-align: middle;
    -webkit-animation: rotate 0.75s linear infinite;
    animation: rotate 0.75s linear infinite;
}
@-webkit-keyframes rotate {
    0% {
        -webkit-transform: rotate(0deg);
    }
    50% {
        -webkit-transform: rotate(180deg);
    }
    100% {
        -webkit-transform: rotate(360deg);
    }
}
@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }
    50% {
        transform: rotate(180deg);
    }
    100% {
        transform: rotate(360deg);
    }
}
    .opacity{
        -webkit-animation: opacity 0.3s linear;
        animation: opacity 0.3s linear;
    }
    @-webkit-keyframes opacity {
        0% {
            opacity:0;
        }
        100% {
            opacity:1;
        }
    }
    @keyframes opacity {
        0% {
            opacity:0;
        }
        100% {
            opacity:1;
        }
    }	
.aui-search-box1 {
    margin-left: -23%;
    height: 31px;
}			
				
				
				</style>
    </head>
    <body>
        <section class="aui-flexView">
            <header class="aui-navBar aui-navBar-fixed">
			
                <a href="javascript:history.back(-1);" class="aui-navBar-item">
                    <i class="icon icon-return"></i>
                </a>
				
                <div class="aui-center" style="width:100%">
                    <div class="aui-search-box1">
                        <i class="icon icon-search"></i>
                        <input type="text" id="sname" value="<?=$_GET['s']?>" placeholder="搜索你想要的商品">
                    </div>
                </div>
				
                <a href="javascript:;" class="aui-navBar-item" style="min-width: 14%; flex: 0 0 14%;">
             
                    <span onclick="add(1)"  class="aui-badge" style="font-size: 27px;border: 0;padding: 3px;border-radius: 7px;height: 27px;"><div style="width: 40px;"><p style="font-size: 16px; text-align: center; color:#ffb400;">搜索</p></div></span>
                </a>
				
            </header>			
            <section class="aui-scrollView">		
			<div id="sbad">
               <img src="ui/image/z3.png" style="position: absolute;top: 10%; width: 100%; height: 35%;">
               <div style="position: absolute;bottom: 0%; width: 100%; height: 50%;">
			   <?php
			    $sql1 = "select * from tbl_taospp where goodstype=1 and state=1 order by rand() LIMIT 4";
                $query1 = mysql_query($sql1);
		        while ($row=mysql_fetch_array($query1)) {
					$a =explode(",", $row['img']);
                ?>
        <div tapmode="" onclick="javascript:window.location.href='/haigou/htspxq.php?fid= <?=$row['id']?> '" class=" H-display-table-cell H-float-left H-box-sizing-border-box H-width-avg-2 H-margin-vertical-bottom-5" style="height:274px;background-color: white;border-style: solid;border-color: #ffffff; width: 49%; float: right;">
            <div class="H-theme-background-color-white H-margin-horizontal-right-5" style="height:172px;">
                <img src=" <?php echo $a[0] ?>" class="H-width-100-percent H-display-block" style="width: 99%;" alt="" title="">
                <div class="H-padding-horizontal-both-3 H-text-show-row-2 H-padding-vertical-top-5">
                    <span class="H-font-size-12 H-theme-font-color-white H-padding-horizontal-both-2 H-border-radius-3 H-margin-horizontal-right-3 H-theme-background-color4"></span><?=mb_substr($row['chtitle'],0,9,'utf-8')?>
                </div>
                <div class="H-padding-horizontal-both-3 H-flex-item H-theme-font-color7 H-text-align-left H-vertical-middle">
                    <span class="H-font-size-12 H-margin-horizontal-right-5" style="font-size: 14px; color: #FDC637;">￥
            <?=$row['zswprice']?>
          </span>
          ￥<span class="H-font-size-12 H-margin-horizontal-right-5">
          <?=$row['vip_price']?>     
          </span>
                </div>
                <div class="H-padding-horizontal-both-3 H-flex-item H-theme-font-color7 H-text-align-left H-vertical-middle">
                    <span class="H-font-size-12 H-margin-horizontal-right-5" style="font-size: 14px; color: #FDC637;">
            &nbsp;&nbsp;<img src="/haigou/ui/img/组 25.png" style="width: 40px;">
          </span>
                </div>
            </div>
        </div>
		  <?php } ?>
               </div>
			   </div>
			    <nav class="aui-nav-box">
                    <a href="javascript:;" id="zhoh" onclick="add(1)"  class="aui-nav-item aui-nav-item-active">综合排序</a>
                    <a href="javascript:;" id="newp" onclick="add(2)"  class="aui-nav-item ">新品</a>
                    <a href="javascript:;" id="xiao" onclick="add(3)"  class="aui-nav-item ">销量</a>
                    <a href="javascript:;" id="jiage" onclick="add(4)"  class="aui-nav-item ">价格</a>
          </nav>
  	       

			        <div class="aui-shop-layout">

                    <div class="aui-shop-list aui-shop-list-selected">
				             
       
                    </div>	
                </div>	
				
            </section>

        </section>
		
		<script>
	  function add(a){
		          var dom2 = document.getElementById('zhoh');
                  var dom3 = document.getElementById('newp');
                  var dom4 = document.getElementById('xiao');
                  var dom5 = document.getElementById('jiage');
				  var  sidd=a;
				  if(a==1){
                  $(dom2).toggleClass('aui-nav-item');
                  $(dom3).removeClass('aui-nav-item-active')
                  $(dom4).removeClass('aui-nav-item-active')
                  $(dom5).removeClass('aui-nav-item-active')				  
                  $(dom2).addClass('aui-nav-item');
                  $(dom2).addClass('aui-nav-item-active');					  
				  } 
				  if(a==2){
                  $(dom3).toggleClass('aui-nav-item');
                  $(dom2).removeClass('aui-nav-item-active')
                  $(dom4).removeClass('aui-nav-item-active')
                  $(dom5).removeClass('aui-nav-item-active')				  
                  $(dom3).addClass('aui-nav-item');
                  $(dom3).addClass('aui-nav-item-active');					  
				  }
				  if(a==3){
                  $(dom4).toggleClass('aui-nav-item');
                  $(dom3).removeClass('aui-nav-item-active')
                  $(dom2).removeClass('aui-nav-item-active')
                  $(dom5).removeClass('aui-nav-item-active')				  
                  $(dom4).addClass('aui-nav-item');
                  $(dom4).addClass('aui-nav-item-active');					  
				  }
				  if(a==4){
                  $(dom5).toggleClass('aui-nav-item');
                  $(dom3).removeClass('aui-nav-item-active')
                  $(dom4).removeClass('aui-nav-item-active')
                  $(dom2).removeClass('aui-nav-item-active')				  
                  $(dom5).addClass('aui-nav-item');
                  $(dom5).addClass('aui-nav-item-active');					  
				  }
				  
				  

		  var sname = document.getElementById("sname").value;   
$("#sbad").empty();		  
$(".aui-shop-list").empty();
	   
if(sname==""){
  layer.open({
    content: '请输入搜索词'
    ,skin: 'msg'
    ,time: 2 //2秒后自动关闭
  });
	
 return false;	
}


$(function(){
    // 页数
    var page = 0;
    // 每页展示5个
    var size = 2;
	
	
  

    // dropload
	
    $('.aui-shop-layout').dropload({
        scrollArea : window,
        loadDownFn : function(me){
            page++;
            // 拼接HTML
            var result = '';
            $.ajax({
                type: 'GET',
                url: 'myserapic.php?page='+page+'&sname='+sname+'&sidd='+sidd,
                dataType: 'json',
                success: function(data){
					
					if(data==0){
						me.lock();
                        // 无数据
                        me.noData();
						  me.resetload();
						$(".dropload-noData").empty();	
					    $(".dropload-load").empty();
					 // layer.open({
                    // content: 'end'
                   // ,skin: 'msg'
                   // ,time: 2 //2秒后自动关闭
                    // });	
					return false;	
					}
					
					   var arrLen = data.data.length;
			
                    if(arrLen > 0){

                        for(var i=0; i<arrLen; i++){
							
                            result += '<a href="/haigou/htspxq.php?fid='+data.data[i].id+'" class="aui-shop-list-item">'
                             +'<div class="aui-shop-list-item-hd">'
                              + ' <img src="'+data.data[i].img+'" alt="">'
                           +' </div>	'					
                           + '<div class="aui-shop-list-item-bd">'
                               + '<h3>'+data.data[i].title+'</h3>'
                               
							
								   
		                            + ' <p class="aui-special-etc">'
                                  + ' <span class="aui-special-etc-hd">￥'+data.data[i].price+'</span>'
								  
                       +'<img style="margin-left:10px;width:39%;" src="/haigou/ui/img/组 25.png">'
					  +' <span>￥'+data.data[i].vip_price
                        +'</span>'
					
                   + '</p>'						   
							  
							   

				   
                           + '</div>'
                       +' </a>'

                        }
                    // 如果没有数据
                    }else{
   						alert('无搜索结果');  
						// 锁定
                        me.lock();
                        // 无数据
                        me.noData();
						

                    }
                        // 插入数据到页面，放到最后面
                        $('.aui-shop-list').append(result);
                        // 每次数据插入，必须重置
                        me.resetload();
							
                
                },
                error: function(xhr, type){
                    alert('Ajax error!');
                    // 即使加载出错，也得重置
                    me.resetload();
                }
            });
        }
    });
}); 
	  }
	  
		</script>	
		
		<script>
$(function(){
    // 页数
    var page = 0;
    // 每页展示5个
 var sname='<?=$_GET['s']?>';
if(sname==""){
	console.log("无搜索词");	
  // layer.open({
    // content: '请输入搜索词'
    // ,skin: 'msg'
    // ,time: 2 //2秒后自动关闭
  // });	
	
	return false;

}
     $('.aui-shop-layout').dropload({
        scrollArea : window,
        loadDownFn : function(me){
            page++;
            // 拼接HTML
            var result = '';
            $.ajax({
                type: 'GET',
                url: 'myserapi.php?page='+page+'&sname='+sname,
                dataType: 'json',
                success: function(data){
					
					if(data==0){
						me.lock();
                        // 无数据
                        me.noData();
						  me.resetload();
						$(".dropload-noData").empty();	
					    $(".dropload-load").empty();
					 // layer.open({
                    // content: 'end'
                   // ,skin: 'msg'
                   // ,time: 2 //2秒后自动关闭
                    // });	
					return false;	
					}
					
					   var arrLen = data.data.length;
			
                    if(arrLen > 0){

                        for(var i=0; i<arrLen; i++){
							
                            result += '<a href="/haigou/htspxq.php?fid='+data.data[i].id+'" class="aui-shop-list-item">'
                             +'<div class="aui-shop-list-item-hd">'
                              + ' <img src="'+data.data[i].img+'" alt="">'
                           +' </div>	'					
                           + '<div class="aui-shop-list-item-bd">'
                               + '<h3>'+data.data[i].title+'</h3>'
                               + '<p class="aui-special-text">'
                               +  '<span>'+data.data[i].enbrand+'</span>'
                               + '</p>'
                              + ' <p class="aui-special-etc">'
                                  + ' <span class="aui-special-etc-hd">￥'+data.data[i].price+'</span>'
                       +'<img src="/ui/xianzhi/images/尿裤湿巾.png" alt="" style="width: 20px;margin-left: 38px;">'
					  +' <span style="margin-top: 5px;position: absolute;margin-left: 10px;font-size: 8px;float: right;">xxxxxx</span>'
                   + '</p>'
                           + '</div>'
                       +' </a>'

                        }
                    // 如果没有数据
                    }else{
   						alert('无搜索结果');  
						// 锁定
                        me.lock();
                        // 无数据
                        me.noData();
						

                    }
                        // 插入数据到页面，放到最后面
                        $('.aui-shop-list').append(result);
                        // 每次数据插入，必须重置
                        me.resetload();
							
                
                },
                error: function(xhr, type){
                    alert('Ajax error!');
                    // 即使加载出错，也得重置
                    me.resetload();
                }
            });
        }
    });
	
	
	
});
</script>		
	
    </body>
</html>